from django.urls import path
from stocksys.views import views as stocksys_views
from stocksys.views import stock_views as stocksys_stock_views, \
    fund_views as stocksys_fund_views, \
    market_index_views as stocksys_market_index_views,\
    industry_views as stocksys_industry_views,\
    conceptual_views as stocksys_conceptual_views,\
    exchange_analysis_views as stocksys_exchange_analysis_views,\
    user_views as stocksys_user_views
from stocksys.views import certificate_views as stocksys_certificate_views,tasks_views as stocksys_tasks_views,prediction_views as stocksys_prediction_views
app_name = 'stocksys'
urlpatterns = [
    path('', stocksys_views.index, name="stocksys_index"),
    path('search/<str:code>/<str:exchange_type>', stocksys_views.search,name='stocksys_search'),

    # 数据相关 stocksys_tasks_views
    path('data_update/', stocksys_tasks_views.data_update, name="data_update"),
    path('data_update_action/<str:id>', stocksys_tasks_views.data_update_action, name="data_update_action"),
    path('task_monitor/', stocksys_tasks_views.task_monitor),


    # 规则相关逻辑stocksys_prediction_views
    path('quant_rules/', stocksys_prediction_views.quant_rules, name="quant_rules"),
    path('quant_rule_predict/<int:addr>/<str:code>/<str:start_date>/<str:end_date>/<str:exchange_type>',
         stocksys_prediction_views.quant_rule_predict, name="quant_rule_predict"),

    path('save_rules/', stocksys_prediction_views.rule_editor, name="save_rules"),
    path('delete_rules/', stocksys_prediction_views.rule_editor, name="delete_rules"),
    path('rule_editor/', stocksys_prediction_views.rule_editor, name="rule_editor"),
    path('rule_editor/<int:id>', stocksys_prediction_views.rule_editor, name="rule_edit"),
    path('rule_editor_put/', stocksys_prediction_views.rule_editor, name="rule_editor_put"),

    path('managed_code/', stocksys_prediction_views.managed_code, name="managed_code"),
    path('code_editor/<int:id>/', stocksys_prediction_views.code_editor, name="code_editor"),
    path('back_test/', stocksys_prediction_views.back_test, name="back_test"),

    # stocksys_stock_views
    path('stock_list/', stocksys_stock_views.stock_list, name="stock_list"),
    path('stock_info/<str:code>/<int:addr>/<str:year>', stocksys_stock_views.stock_info, name="stock_info"),
    path('stock_time_info/', stocksys_stock_views.stock_time_info, name="stock_time_info"),

    # stocksys_fund_views
    path('fund_list/', stocksys_fund_views.fund_list, name="fund_list"),
    path('fund_info/<str:code>/<str:addr>/<str:year>', stocksys_fund_views.fund_info, name="fund_info"),
    path('fund_time_info/', stocksys_fund_views.fund_time_info, name="fund_time_info"),

    # stocksys_market_index_views
    path('market_index_list/', stocksys_market_index_views.market_index_list, name="market_index_list"),
    path('market_index_info/<str:code>/<int:addr>/<str:year>', stocksys_market_index_views.market_index_info,
         name="market_index_info"),
    path('market_index_time_info/', stocksys_market_index_views.market_index_time_info, name="market_index_time_info"),

    # 行业数据
    path('industry_info/', stocksys_industry_views.industry_info, name='industry_info'),
    path('industry_panel/', stocksys_industry_views.industry_panel, name='industry_panel'),
    path('industry_stock/<int:id>', stocksys_industry_views.industry_stock, name="industry_stock"),

    # 概念数据
    path('conceptual_info/', stocksys_conceptual_views.conceptual_info,name='conceptual_info'),
    path('conceptual_panel/', stocksys_conceptual_views.conceptual_panel,name='conceptual_panel'),
    path('concept_stock/<int:id>', stocksys_conceptual_views.concept_stock, name="concept_stock"),

    # 添加视图函数以后要在URL里添加路由
    # exchange_chg

    # USER
    path('stocksys_bonds/', stocksys_user_views.user_bonds, name='user_bonds'),
    path('buy_stock/', stocksys_user_views.user_bonds, name='buy_stock'),
    path('sell_stock/', stocksys_user_views.user_bonds, name='sell_stock'),
    path('edit_price/', stocksys_user_views.user_bonds, name='edit_price'),

    path('user_order/', stocksys_user_views.user_order, name='user_order'),
    path('cancel_order/', stocksys_user_views.user_order, name='cancel_order'),

    path('user_settings/', stocksys_user_views.user_settings, name='user_settings'),
    path('user_validate/', stocksys_user_views.user_validate, name='user_validate'),
    path('stocksys_profile/', stocksys_user_views.user_profile, name='stocksys_profile'),
    path('stocksys_login/', stocksys_user_views.login, name='stocksys_login'),
    path('stocksys_logout/', stocksys_user_views.logout, name='stocksys_logout'),
    path('site_message/', stocksys_user_views.message, name='site_message'),
    path('site_message/<int:id>', stocksys_user_views.user_message_content, name='user_message_content'),
    path('site_message/sendmessage/', stocksys_user_views.send_message, name='send_message'),
    path('add_mystock/', stocksys_user_views.mystock, name='add_mystock'),
    path('delete_mystock/', stocksys_user_views.mystock, name='delete_mystock'),
    path('mystock/', stocksys_user_views.mystock, name='mystock'),

    # stocksys_certificate_views测试接口
    path('test_demo/', stocksys_certificate_views.test_demo),
]
